
	
/*
 * 自动计算表单数据
 */
function calFormItem() {
    var domForm = $('#' + window.formObj.c.id_form);
	var bidInvoiceOffset = domForm.find('input[name="bidInvoiceOffset"]').val(); // 预核销单号
	var taxPercent = parseFloat(domForm.find('input[name="taxPercent"]').val()); // 统一税点
	
	$.ajax({
		type: "POST",
		url: '/api/inter/tcgInvoiceOffset/listItemByBid',
		data: {bid: bidInvoiceOffset},
		success: function (data) {
			if (data.code == 0) {
				var rows = data.data;
				if (taxPercent) {
					for (var i = 0; i < rows.length; i++) {
						rows[i]['offsetAmountNoTax'] = Math.round(rows[i]['offsetAmount'] / (1 + taxPercent) * 100) / 100; // 子件总额(不含税)
						rows[i]['subPurchasePriceNoTax'] = Math.round(rows[i]['offsetAmountNoTax'] / rows[i]['offsetNum'] * 100) / 100; // 子件单价(不含税)
						rows[i]['subTax'] =  Math.round((rows[i]['offsetAmount'] - rows[i]['offsetAmountNoTax']) * 100) / 100; // 子件总税额
					}
				}
				
				formObj.c.subGridObj.clearRows();
				formObj.c.subGridObj.addRows(rows);
			} else {
				alert(data.msg);
			}
		}
	});
	
	return;
}